﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Runtime.Remoting;
using NUnit.Framework;

namespace Imgur.Net.Test
{
    [TestFixture]
    public class AlbumInfoTests
    {
        [Test]
        public void TestCreateInstance1()
        {
            const string id = "12345";
            const string title = "The Album Title";
            const string description = "A descr of the album";
            DateTime timestamp = DateTime.Now;
            const LayoutStyle layout = LayoutStyle.Grid;
            const int views = 450;
            const string link = "http://imgur.com/a/3213asdf";
            const string deletehash = "aasdf9234a";

            var instance = new AlbumInfo(id, title, description, timestamp, layout, views, link, deletehash);

            Assert.AreEqual(id, instance.Id);
            Assert.AreEqual(title, instance.Title);
            Assert.AreEqual(description, instance.Description);
            Assert.AreEqual(timestamp, instance.TimeStamp);
            Assert.AreEqual(layout, instance.Layout);
            Assert.AreEqual(views, instance.Views);
            Assert.AreEqual(link, instance.Link);
            Assert.AreEqual(deletehash, instance.DeleteHash);
        }

        [Test]
        public void TestCreateInstance2()
        {
            const string id = "12345";
            const string title = "The Album Title";
            const string description = "A descr of the album";
            DateTime timestamp = DateTime.Now;
            const string coverId = "abcde";
            const int coverWidth = 200;
            const int coverHeight = 300;
            const string accountUrl = "http://imgur.com/users/1234";
            const PrivacyLevel privacyLevel = PrivacyLevel.Public;
            const LayoutStyle layout = LayoutStyle.Grid;
            const int views = 450;
            const string link = "http://imgur.com/a/3213asdf";
            const bool isFavorite = false;
            const bool isNsfw = false;
            const string section = "cats";
            const int imagesCount = 3;
            const string deletehash = "aasdf9234a";
            const int order = 2;

            var instance = new AlbumInfo(id, title, description, timestamp, coverId, coverWidth, coverHeight, accountUrl,
                privacyLevel,
                layout, views, link, isFavorite, isNsfw, section, imagesCount, deletehash, order);

            Assert.AreEqual(id, instance.Id);
            Assert.AreEqual(title, instance.Title);
            Assert.AreEqual(description, instance.Description);
            Assert.AreEqual(timestamp, instance.TimeStamp);
            Assert.AreEqual(coverId, instance.AlbumCoverId);
            Assert.AreEqual(coverWidth, instance.AlbumCoverWidth);
            Assert.AreEqual(coverHeight, instance.AlbumCoverHeight);
            Assert.AreEqual(accountUrl, instance.AccountUrl);
            Assert.AreEqual(privacyLevel, instance.PrivacyLevel);
            Assert.AreEqual(layout, instance.Layout);
            Assert.AreEqual(views, instance.Views);
            Assert.AreEqual(link, instance.Link);
            Assert.IsNotNull(instance.IsFavorite);
            Assert.IsTrue(instance.IsFavorite.HasValue);
            Assert.IsFalse(instance.IsFavorite.Value);
            Assert.IsNotNull(instance.IsNSFW);
            Assert.IsTrue(instance.IsNSFW.HasValue);
            Assert.IsFalse(instance.IsNSFW.Value);
            Assert.AreEqual(section, instance.Section);
            Assert.AreEqual(imagesCount, instance.ImagesCount);
            Assert.AreEqual(deletehash, instance.DeleteHash);
            Assert.AreEqual(order, instance.Order);
        }


        [Test]
        public void TestCreateInstance3()
        {
            const string id = "12345";
            const string title = "The Album Title";
            const string description = "A descr of the album";
            DateTime timestamp = DateTime.Now;
            const string coverId = "abcde";
            const int coverWidth = 200;
            const int coverHeight = 300;
            const string accountUrl = "http://imgur.com/users/1234";
            const PrivacyLevel privacyLevel = PrivacyLevel.Public;
            const LayoutStyle layout = LayoutStyle.Grid;
            const int views = 450;
            const string link = "http://imgur.com/a/3213asdf";
            const bool isFavorite = false;
            const bool isNsfw = false;
            const string section = "cats";
            List<ImageInfo> images = new List<ImageInfo>
            {
                new ImageInfo("123", string.Empty, string.Empty, DateTime.Now, 100, 100 ),
                new ImageInfo("456", string.Empty, string.Empty, DateTime.Now, 100, 100 ),
                new ImageInfo("789", string.Empty, string.Empty, DateTime.Now, 100, 100 )
            };
            const int imagesCount = 3;
            const string deletehash = "aasdf9234a";
            const int order = 2;

            var instance = new AlbumInfo(id, title, description, timestamp, coverId, coverWidth, coverHeight,
                accountUrl, privacyLevel, layout, views, link, isFavorite, isNsfw, section, images, imagesCount,
                deletehash, order);

            Assert.AreEqual(id, instance.Id);
            Assert.AreEqual(title, instance.Title);
            Assert.AreEqual(description, instance.Description);
            Assert.AreEqual(timestamp, instance.TimeStamp);
            Assert.AreEqual(coverId, instance.AlbumCoverId);
            Assert.AreEqual(coverWidth, instance.AlbumCoverWidth);
            Assert.AreEqual(coverHeight, instance.AlbumCoverHeight);
            Assert.AreEqual(accountUrl, instance.AccountUrl);
            Assert.AreEqual(privacyLevel, instance.PrivacyLevel);
            Assert.AreEqual(layout, instance.Layout);
            Assert.AreEqual(views, instance.Views);
            Assert.AreEqual(link, instance.Link);
            Assert.IsNotNull(instance.IsFavorite);
            Assert.IsTrue(instance.IsFavorite.HasValue);
            Assert.IsFalse(instance.IsFavorite.Value);
            Assert.IsNotNull(instance.IsNSFW);
            Assert.IsTrue(instance.IsNSFW.HasValue);
            Assert.IsFalse(instance.IsNSFW.Value);
            Assert.AreEqual(section, instance.Section);
            CollectionAssert.AreEquivalent(images, instance.Images);
            Assert.AreEqual(imagesCount, instance.ImagesCount);
            Assert.AreEqual(deletehash, instance.DeleteHash);
            Assert.AreEqual(order, instance.Order);
        }
    }
}
